package com.ruoyi.orders.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.orders.domain.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.orders.mapper.OrdersMapper;
import com.ruoyi.orders.domain.Orders;
import com.ruoyi.orders.service.IOrdersService;

/**
 * 订单功能Service业务层处理
 * 
 * @author atzxc
 * @date 2024-05-02
 */
@Service
public class OrdersServiceImpl implements IOrdersService
{
    @Autowired
    private OrdersMapper ordersMapper;

    /**
     * 查询订单功能
     * 
     * @param orderId 订单功能主键
     * @return 订单功能
     */
    @Override
    public Orders selectOrdersByOrderId(Long orderId)
    {
        return ordersMapper.selectOrdersByOrderId(orderId);
    }

    /**
     * 查询订单功能列表
     * 
     * @param orders 订单功能
     * @return 订单功能
     */
    @Override
    public List<Orders> selectOrdersList(Orders orders)
    {
        return ordersMapper.selectOrdersList(orders);
    }

    @Override
    public List<Orders> selectOrderInfoByCategoryId(Orders orders, String categoryId) {
        System.out.println("进来了"+orders+",categoryId"+categoryId);

        LambdaQueryWrapper<Orders> queryWrap = new LambdaQueryWrapper<>();
        queryWrap.eq(Orders::getCategoryId,categoryId);
        List<Orders> orderList = ordersMapper.selectList(queryWrap);
        for (Orders orders1 : orderList) {
            System.out.println(orders1);
        }

//        List<Orders> orderList = ordersMapper.selectOrderInfoByCategoryId(categoryId);
        return orderList;

    }

    /**
     * 新增订单功能
     * 
     * @param orders 订单功能
     * @return 结果
     */
    @Override
    public int insertOrders(Orders orders)
    {
        return ordersMapper.insertOrders(orders);
    }

    /**
     * 修改订单功能
     * 
     * @param orders 订单功能
     * @return 结果
     */
    @Override
    public int updateOrders(Orders orders)
    {
        return ordersMapper.updateOrders(orders);
    }

    /**
     * 批量删除订单功能
     * 
     * @param orderIds 需要删除的订单功能主键
     * @return 结果
     */
    @Override
    public int deleteOrdersByOrderIds(Long[] orderIds)
    {
        return ordersMapper.deleteOrdersByOrderIds(orderIds);
    }

    /**
     * 删除订单功能信息
     * 
     * @param orderId 订单功能主键
     * @return 结果
     */
    @Override
    public int deleteOrdersByOrderId(Long orderId)
    {
        return ordersMapper.deleteOrdersByOrderId(orderId);
    }
}
